<%layout("/common/_layout.html"){ %>
<script type="text/javascript">
var keywordsObj = {};
var submit_btn = function(businessType,singleApi){

    if($("#time_start").val())
        keywordsObj.time_start = $("#time_start").val();
    if($("#time_end").val())
        keywordsObj.time_end = $("#time_end").val();
	if($("#api_option").val())
		keywordsObj.api = $("#api_option").val();

    var keywords = "";
    if(!$.isEmptyObject(keywordsObj)){
      keywords = JSON.stringify(keywordsObj);
    }
    $("#keywords").val(keywords);


	if(businessType == "search"){
		$("#list-form").submit();
	}else if(businessType == "export"){
		window.location.href = "${base}/apiLog/apiTimeRangeByDayExport?keywords="+keywords;
	}
}
</script>
<%#ajax userTable:{%>
<div class="am-cf am-padding">
	<div class="am-fl am-cf">
		<strong class="am-text-primary am-text-lg">报表中心</strong> / <small>按天接口调用统计</small>
	</div>
</div>

<div class="am-g">
	<%include("api_log_query_byday.tpl"){}%>
	<div class="am-u-sm-12 am-u-md-12"
		style="padding: 0 1.6rem 1.6rem 1rem; margin: 0;">
		<div class="am-btn-toolbar" style="padding-left: .5rem;">
			<div class="am-btn-group am-btn-group-xs">
				<div class="am-btn-group am-btn-group-xs am-form-file">

				</div>
			</div>
		</div>
	</div>
</div>

	<div class="am-g">
		<div  style="min-height: 200px;">
			<div class="am-scrollable-horizontal">
				<table class="am-table am-table-striped am-table-hover table-main" >
					<thead>
						<tr class="am-text-nowrap">
							<th>接口名</th>
							<th>日期</th>
							<th>总调用次数</th>
							<th>接口成功数</th>
							<th>接口失败数</th>
							<th>接口失败率</th>
							<th>业务成功数</th>
                            <th>业务失败数</th>
                            <th>业务失败率</th>
						</tr>
					</thead>
					<tbody>
					<%for(record in records!){%>
                        <tr>
                            <td>${record.api!}</td>
                            <td>${record.opt_time!}</td>
                            <td>${record.total!}</td>
                            <td>${record.apiSuccess!}</td>
                            <td>${record.apiFailed!}</td>
                            <td>${record.apiFailedPercent!}</td>
                            <td>${record.businessSuccess!}</td>
                            <td>${record.businessFailed!}</td>
                            <td>${record.businessFailedPercent!}</td>
                        </tr>
                    <%}%>
					</tbody>
				</table>
			</div>

			<div class="am-cf">
				<!-- 分页 -->
				<%if (records.~size >
				0){%>
				<div class="am-fr">
					<% include("/admin/common_pager.tpl"){}%></div>
				<%}else{%>
				<div class="am-kai">
					<h3>没有找到任何记录!</h3>
				</div>
				<%}%></div>
		</div>
		</div>
	</div>
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal">
		<div class="am-modal-dialog">
			<div class="am-modal-hd">
				<i class="am-icon-refresh am-icon-spin"></i> <a
					href="javascript: void(0)" class="am-close am-close-spin"
					data-am-modal-close>&times;</a>
			</div>
			<div class="am-modal-bd">正在处理，请稍等...</div>
		</div>
	</div>
	<%}%> <%}%>